<template>
<h1>计算机练习</h1>
  <input type="text" v-model="a"><br>
  <input type="text" v-model="b"><br>
  <button @click="calc('+')">+</button>
  <button @click="calc('-')">-</button>
  <button @click="calc('*')">*</button>
  <button @click="calc('/')">÷</button>
  <h4 >{{"结果："+res}}</h4>
</template>


<script setup>
import {ref} from "vue";

const a=ref('')
const b=ref('')
const res=ref('')
const calc=(o)=>{
  res.value=eval(a.value+o+b.value)
}
</script>

<style scoped>

</style>